<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc"%>
<%@ include file="/WEB-INF/inc/script.inc"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="${base}">
<title>中金通 | 新增产品</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.responsive.css" rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.tableTools.min.css" rel="stylesheet">

<!-- 向导css -->
<link href="css/plugins/steps/jquery.steps.css" rel="stylesheet">
<!-- end -->
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">

 <!-- 下拉框 -->
<link href="css/plugins/chosen/chosen.css" rel="stylesheet">
<style type="text/css">
textarea {
	resize: none;
}

.detailText
	{
	 padding:6px 12px; 
	}
	
.form-control[readonly]{
		background-color: #fff;
			opacity: 1;
	}
</style>


</head>

<body>

	<div id="wrapper">

		<!-- 左侧菜单 -->
		<jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>

		<div id="page-wrapper" class="gray-bg">
			<div class="row border-bottom">
				<!-- 头部工具栏区 -->
				<jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
			</div>
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-10">
					<h2>产品管理</h2>
					<ol class="breadcrumb">
						<li><a href="common/platform">Home</a></li>
						<li><a href="product/list">产品管理</a></li>
						<li><a href="product/list">产品列表</a></li>
						<li class="active"><strong>新增产品</strong></li>
					</ol>
				</div>
				<div class="col-lg-2"></div>
			</div>

			<div class="row" style="margin-top: 10px;">
				<div class="col-md-12">
					<div class="tabs-container">
						<ul class="nav nav-tabs">
							<li><a href="product/list"> 产品列表 </a></li>
							<li class="active"><a> 新增产品 </a></li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane active">
								<div class="panel-body">
									<div class="wrapper wrapper-content animated fadeInRight ecommerce">
										<div>
											<form method="post" id="addForm" enctype="multipart/form-data" action="product/doAdd" class="form-horizontal wizard-big">
												<input type="text" name="id" style="display:none" value="${product.id}">
												
												<!--Detail form start-->
												<h1>产品基本信息</h1>
                                				<fieldset>
						                            <div class="row">
									                    <div class="col-sm-6">
									                       <div class="form-group">
									                           <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>产品代码</label>
						                                       <div class="col-sm-8">
						                                    	   <input type="text" name="productCode" class="form-control" placeholder="产品代码" value="${product.productCode}">
						                                       </div>
									                       </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label" style="position:relative;margin-left:-18px;width:19%;"><font color="red">*&nbsp;&nbsp;</font>产品全称</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="productName" class="form-control" placeholder="产品全称" value="${product.productName}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                            <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>产品简称</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="briefName" class="form-control" placeholder="产品简称" value="${product.briefName}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>基金管理人</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="fundManager" class="form-control" placeholder="基金管理人" value="${product.fundManager}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                            <!--  <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>基金托管人</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="fundTrustee" class="form-control" placeholder="基金托管人" value="${product.fundTrustee}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>产品承销</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="underWriter" class="form-control" placeholder="产品承销" value="${product.underWriter}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>收益类型</label>
						                                        <div class="col-sm-8">
						                                    	   <select id="incomeType" class="form-control m-b" name="incomeType" >
										                              <!-- <option value="">所有</option> -->
										                              <option value="0">固定</option>
										                              <option value="1">浮动</option>
										                              <option value="2">固定+浮动</option>
										                           </select>
						                                        </div>
									                        </div>
									                    </div>
									                      <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>运作方式</label>
						                                        <div class="col-sm-8">
						                                    	   <select id="operationMode" class="form-control m-b" name="operationMode" onchange="checkOpenDate()">
										                              <!-- <option value="">所有</option> -->
										                              <option value="0">开放式</option>
										                              <option value="1">封闭式</option>
										                           </select>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">开放日</label>
						                                        <div class="col-sm-8">
						                                    	   <input id="openDate" type="text" name="openDate" class="form-control" placeholder="开放日" value="${product.openDate}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">开放周期</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="openCycle" class="form-control" placeholder="开放周期" value="${product.openCycle}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>投资规模(元)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="scale" class="form-control" placeholder="投资规模" value='<fmt:formatNumber value="${product.scale}"  pattern="0.00"/>'>
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>投资期限(月)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="duration" class="form-control" placeholder="投资期限" value="${product.duration}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                              <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>招募开始时间</label>
						                                        <div class="col-sm-8">
						                                    	   <input id="recruitStartTime" type="text" name="recruitStartTime" class="form-control" placeholder="招募开始时间" value='<fmt:formatDate value="${product.recruitStartTime}" pattern="yyyy-MM-dd"/>' readonly="readonly">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>招募截止时间</label>
						                                        <div class="col-sm-8">
						                                    	   <input id="recruitEndTime" type="text" name="recruitEndTime" class="form-control" placeholder="招募截止时间" value='<fmt:formatDate value="${product.recruitEndTime}" pattern="yyyy-MM-dd"/>' readonly="readonly">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>投资起点(元)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="subStart" class="form-control" placeholder="投资起点" value='<fmt:formatNumber value="${product.subStart}" pattern="0.00"/>'>
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>递增金额(元)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="increaseAmount" class="form-control" placeholder="递增金额" value='<fmt:formatNumber value="${product.increaseAmount}" pattern="0.00"/>'>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>开户行</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="bankDeposit" class="form-control" placeholder="开户行" value="${product.bankDeposit}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>开户名</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="bankName" class="form-control" placeholder="开户名" value="${product.bankName}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                              <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>企业银行账户</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="bankAccount" class="form-control" placeholder="企业银行账户" value="${product.bankAccount}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>预期收益</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="prospectiveEarnings" class="form-control" placeholder="预期收益" value="${product.prospectiveEarnings}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">收益分配</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="incomeDivide" class="form-control" placeholder="收益分配" value="${product.incomeDivide}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>产品评级</label>
						                                        <div class="col-sm-8">
						                                    	   <%-- <input type="text" name="level" class="form-control" placeholder="产品评级" value="${product.level}"> --%>
						                                    	   <select id="level" class="form-control m-b" name="level" >
										                              <option value="1">☆</option>
										                              <option value="2">★</option>
														              <option value="3">★☆</option>
														              <option value="4">★★</option>
														              <option value="5">★★☆</option>
														              <option value="6">★★★</option>
														              <option value="7">★★★☆</option>
														              <option value="8">★★★★</option>
														              <option value="9">★★★★☆</option>
														              <option value="10">★★★★★</option>
										                           </select>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>认购费/申购费率(%)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="subFee" class="form-control" placeholder="认购费/申购费" value='<fmt:formatNumber value="${product.subFee}" pattern="0.00" />'>
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>支付手续费(元)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="handlingFee" class="form-control" placeholder="支付手续费" value='<fmt:formatNumber value="${product.handlingFee}" pattern="0.00"/>'>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">赎回费率(%)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="redeemFee" class="form-control" placeholder="赎回费" value='<fmt:formatNumber value="${product.redeemFee}" pattern="0.00" />'>
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">管理费率(%)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="manageFee" class="form-control" placeholder="管理费" value='<fmt:formatNumber value="${product.manageFee}" pattern="0.00" />'>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
									                  <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">托管费率(%)</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="trusteeFee" class="form-control" placeholder="托管费" value='<fmt:formatNumber value="${product.trusteeFee}" pattern="0.00" />'>
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">公司介绍</label>
						                                        <div class="col-sm-8">
						                                    	   <select id="aboutId" class="form-control m-b" name="aboutId" >
										                              <option value="">无</option>
										                           </select>
						                                        </div>
						                                        <span>请到系统管理关于我们进行设置</span>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>集资对象</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="fundRaising" class="form-control" placeholder="集资对象" value="${product.fundRaising}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>咨询电话</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="consultPhone" class="form-control" placeholder="咨询电话" value="${product.consultPhone}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
									                 <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">成立日期</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" id="setupTime" name="setupTime" class="form-control" placeholder="成立日期" value='<fmt:formatDate value="${product.setupTime}" pattern="yyyy-MM-dd"/>' readonly="readonly">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">基金经理</label>
						                                        <div class="col-sm-8">
												                     <select id="_fundManager" name="selectedFundManager" data-placeholder="选择基金经理" class="chosen-select form-control m-b" multiple  tabindex="4">
												                     	<c:if test="${fundManagerList.size() != 0}">
	                													<c:forEach var="i" begin="0" end="${fundManagerList.size()-1}">
														                	<c:if test="${fundManagerList.get(i).getSelected() == true}">
															                	<option value="${fundManagerList.get(i).getId()}" selected="selected">${fundManagerList.get(i).getName()}</option>
															                </c:if>
															                <c:if test="${fundManagerList.get(i).getSelected() == false}">
															                	<option value="${fundManagerList.get(i).getId()}">${fundManagerList.get(i).getName()}</option>
															                </c:if>
														                </c:forEach>
													             		</c:if>
												                    </select>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>合同编号前缀</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="contactPrefix" class="form-control" placeholder="合同编号前缀" value="${product.contactPrefix}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>产品状态</label>
						                                        <div class="col-sm-8">
						                                    	   <select id="state" class="form-control m-b" name="state" >
										                              <!-- <option value="">所有</option> -->
										                              <option value="0">即将上线</option>
							                                		  <option value="1">正在募集中</option>
							                                          <option value="2">募集完成</option>
										                           </select>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
									                 <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">推送组别</label>
						                                        <div class="col-sm-8">
						                                        	<select id="_investorGroup" name="selectedInvestorGroup" data-placeholder="选择推送组别" class="chosen-select form-control m-b" multiple  tabindex="4">
												                     	<option value="-1">全部</option>
												                     	<c:if test="${investorGroupList.size() != 0}">
	                													<c:forEach var="i" begin="0" end="${investorGroupList.size()-1}">
														                	<c:if test="${investorGroupList.get(i).getSelected() == true}">
															                	<option value="${investorGroupList.get(i).getId()}" selected="selected">${investorGroupList.get(i).getName()}</option>
															                </c:if>
															                <c:if test="${investorGroupList.get(i).getSelected() == false}">
															                	<option value="${investorGroupList.get(i).getId()}">${investorGroupList.get(i).getName()}</option>
															                </c:if>
														                </c:forEach>
													             		</c:if>
												                    </select>
						                                        </div>
									                        </div>
									                    </div>
									                    <div id="pushGroup" class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">产品所属组别</label>
						                                        <div class="col-sm-8">
						                                            <select class="form-control m-b" id="productGroupId" name="productGroupId" >
										                                <option value="">无</option>
										                                <c:forEach items="${productGroupList}" var="pg" varStatus="st">
																			<option value="${pg.id}" name="${pg.name}"> ${pg.name}</option>
																		</c:forEach>
								                            		</select>
						                                        </div>
						                                        <span><button type="button" class="btn btn-outline btn-primary" onclick="showProductGroupDialog()">新增</button></span>
									                        </div>
									                    </div>
									                 </div>
									                 <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>排序值</label>
						                                        <div class="col-sm-8">
						                                    	   <input type="text" name="orders" class="form-control" placeholder="排序值" value="${product.orders}">
						                                        </div>
									                        </div>
									                    </div>
									                    <!-- <div class="hr-line-dashed"></div> -->
														<div class="col-sm-6">
															<div class="form-group">
																<label class="col-sm-2 control-label">启息日期</label>
																<div class="col-sm-8">
																	<input type="text" id="interestDate" name="interestDate" class="form-control" placeholder="启息日期" value='<fmt:formatDate value="${product.interestDate}" pattern="yyyy-MM-dd"/>' readonly="readonly">
																</div>
															</div>
														</div>
									                 </div>
									                 <!-- <div class="hr-line-dashed"></div> -->
						                           <div class="row">
									                   <div class="col-sm-6">
									                       <div class="form-group">
									                           <label class="col-sm-4 control-label"><font color="red">*&nbsp;&nbsp;</font>风险揭示书</label>
						                                       <div class="col-sm-8">
						                                        	<select id="riskDisclosureId" class="form-control m-b" name="riskDisclosureId" >
							                                        	<c:forEach items="${riskDisclosureList}" var="pg" varStatus="st">
																			<option value="${pg.id}" name="${pg.name}"> ${pg.name}</option>
																		</c:forEach>
																	</select>
						                                       </div>
									                       </div>
									                   </div>
									                   <div class="col-sm-6">
									                       <div class="form-group">
									                            <label class="col-sm-2 control-label">发行方</label>
						                                        <div class="col-sm-8">
						                                    	   <select id="issuerId" class="form-control m-b" name="issuerId" >
										                              <option value="">无</option>
										                              <c:forEach items="${issuersList}" var="pg" varStatus="st">
																		 <option value="${pg.id}" name="${pg.name}"> ${pg.name}</option>
																	  </c:forEach>
										                           </select>
						                                       </div>
									                       </div>
									                   </div>
									             </div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">
																<font color="red">*&nbsp;&nbsp;</font>产品图片
															</label>
															<div class="col-sm-8">
																<div style="padding-top: 8px">
																   <div id="productImageDiv" style="display:none;padding-bottom:10px">
																		<a title="产品图片" data-gallery="">
																			<img id="showProductImage" style="width:400px;height:300px;" src="${imagePrefix}${product.thumbnail}">
																		</a>
																	</div>
																	<input class="btn btn-outline btn-primary" type="file" id="productImage" name="productImage" accept=".jpg,.jpeg,.png,.bmp">
																</div>
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">产品售卖部门</label>
															<div class="col-sm-8">
																<select id="_employeeGroup" name="selectedEmployeeGroup" data-placeholder="选择产品售卖部门" class="chosen-select form-control m-b" multiple  tabindex="4" style="z-index=10;overflow:auto"  >
													                   <c:if test="${employeeGroupList.size() != 0}">
			                												<c:forEach var="i" begin="0" end="${employeeGroupList.size()-1}">
																                <c:if test="${employeeGroupList.get(i).getSelected() == true}">
																	                <option value="${employeeGroupList.get(i).getId()}" selected="selected">${employeeGroupList.get(i).getGroupName()}</option>
																	            </c:if>
																	            <c:if test="${employeeGroupList.get(i).getSelected() == false}">
																	                <option value="${employeeGroupList.get(i).getId()}">${employeeGroupList.get(i).getGroupName()}</option>
																	            </c:if>
																            </c:forEach>
														             </c:if>
													           </select>
														   </div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
									                 <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">
									                            	<font color="red">*&nbsp;&nbsp;</font>基金投向
									                            </label>
						                                        <div class="col-sm-8">
						                                    	   <textarea id="fundInvest" name="fundInvest" class="form-control" placeholder="基金投向(1-512字)" rows="10">${product.fundInvest}</textarea>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">
																<font color="red">*&nbsp;&nbsp;</font>投资范围
															</label>
															<div class="col-sm-8">
																<textarea id="investScope" name="investScope" class="form-control" placeholder="投资范围(1-1000字)" rows="10"></textarea>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">
																<font color="red">*&nbsp;&nbsp;</font>风控措施
															</label>
															<div class="col-sm-8">
																<textarea id="riskControl" name="riskControl" class="form-control" placeholder="风控措施(1-1000字)" rows="10"></textarea>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">备注</label>
															<div class="col-sm-8">
																<textarea id="remark" name="remark" class="form-control" placeholder="备注(1-1000字)" rows="10"></textarea>
															</div>
														</div>
													</div>
												</div>
										</fieldset>
										<h1>认购合同</h1>
                                				<fieldset>
												<!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">合同示例模版下载</label>
						                                        <div class="col-sm-8">
						                                        	<div style="padding:6px 12px;font-size: 14px">
						                                            	<a  href="product/downloadFile?filePath=${filePath}docs/contactTemplate/基金合同示例模版.docx" title="基金合同示例模版.docx" data-gallery="">基金合同示例模版.docx</a>   
						                                        	</div>
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
									                <!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label"><font
																color="red">*&nbsp;&nbsp;</font>产品合同</label>
															<div class="col-sm-8">
																<table id="productContactFileDiv" width="100%" style = "display:none;">
						                                        		<tr>
						                                        			<td>
						                                    	        		<div id="contactFile" class="detailText" style="font-size: 14px"></div>
						                                           			</td>
						                                           			<td>
						                                    					<button id="reviewContact" type="button" class="btn btn-outline btn-primary btn-xs" onclick="javascript:location.href='product/downloadEffect?productId=${product.id}'">下载预览效果</button>
						                                    				</td>
						                                    			</tr>
						                                    	</table>
						                                    	<table width="100%">
						                                        		<tr>
						                                        			<td>
						                                    	        		<input id="productContactFile" class="btn btn-outline btn-primary" type="file" name="productContactFile" accept=".docx">
						                                           			</td>
						                                           			<td>
						                                    					<button type="button" class="btn btn-outline btn-primary" onclick="uploadProductContact()">上传</button>
						                                    				</td>
						                                    			</tr>
						                                    		</table>
															</div>
														</div>
													</div>
												</div>
									                  <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">占位符说明表</label>
						                                        <div class="col-sm-8">
						                                        	<!-- <div style="padding:6px 12px;font-size: 14px">
						                                        	</div> -->
						                                        	<table class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="modelEditable_info">
										                                <thead>
											                                <tr>
											                                    <th>占位符</th>
											                                    <th>名称</th>
											                                    <th>备注</th>
											                                </tr>
										                                </thead>
										                                <tbody>
										                                	<tr>
										                                		<td>[ContractNumber]</td>
										                                		<td>合同编号</td>
										                                		<td>需要填写合同编号的位置请用“[ContractNumber]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[InvestorName]</td>
										                                		<td>投资人姓名</td>
										                                		<td>需要填写投资人姓名位置，用“[InvestorName]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[InvestorSignName]</td>
										                                		<td>投资人签名</td>
										                                		<td>需要投资人签名的位置用“[InvestorSignName]”</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[SignTime]</td>
										                                		<td>签单时间</td>
										                                		<td>填写签单时间的位置用“[SignTime]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[Amount]</td>
										                                		<td>投资金额</td>
										                                		<td>需要填写投资金额的位置用“[Amount]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[AmountToCN]</td>
										                                		<td>投资金额（大写）</td>
										                                		<td>需要填写投资金额中文大写的位置用“[AmountToCN]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[IDCard]</td>
										                                		<td>证件号</td>
										                                		<td>需要填写证件号的位置用“[IDCard]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[Address]</td>
										                                		<td>通信地址</td>
										                                		<td>需要填写通信地址的位置用“[Address]“占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[Phone]</td>
										                                		<td>联系电话</td>
										                                		<td>需要填写联系电话的位置用”[Phone]“占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[Email]</td>
										                                		<td>邮箱</td>
										                                		<td>需要填写邮箱的位置用”[Email]“占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[AccountName]</td>
										                                		<td>开户名称</td>
										                                		<td>需要填写投资人开户名称的位置用”[AccountName]“占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[BankName]</td>
										                                		<td>开户银行</td>
										                                		<td>需要填写投资人开户银行的位置用“[BankName]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[BankAccount]</td>
										                                		<td>银行帐（卡）号</td>
										                                		<td>需要填写投资人银行账号的位置用“[BankAccount]”占位</td>
										                                	</tr>
										                                	<tr>
										                                		<td>[Electronic]</td>
										                                		<td>电子公章</td>
										                                		<td>需要加盖电子公章的位置用“【Electronic】”占位</td>
										                                	</tr>
										                                </tbody>
										                            </table>
																	备注：
																		1.基金合同上需要填写用户信息的位置，请参照上表，进行占位；
																		2.基金合同请用word2007以上的版本。
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
												</fieldset>
												<h1>产品档次</h1>
                                				<fieldset>
                                				<!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">产品档次</label>
						                                        <div class="col-sm-8">
						                                           <button id="doAddModel" class="delete btn btn-outline btn-primary" type="button">新增档次</button>
						                                    	   <table id="modelEditable" class="table table-striped table-bordered table-hover">
										                                <thead>
										                                <tr>
										                                    <th>档次</th>
										                                    <th>认购范围</th>
										                                    <th>预期收益</th>
										                                    <th>备注</th>
										                                    <th style="background-color:white;">操作</th>
										                                </tr>
										                                </thead>
										                                <tbody>
										                                </tbody>
										                           </table>
						                                       </div>
									                        </div>
									                    </div>
									                 </div>
									            </fieldset>
									            <h1>佣金设置</h1>
                                				<fieldset>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                             <div class="row" style="padding-left:17px">
									                    <div class="col-sm-4">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">佣金设置</label>
						                                        <div class="col-sm-8" style="display: inline">
						                                    	     <input style="display: inline" type="radio"  value="option1" id="optionsRadios1" name="optionsRadios">&nbsp;默认设置&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                     <input style="display: inline" type="radio"  value="option2" id="optionsRadios2" name="optionsRadios">&nbsp;自定义设置
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
									                 <br>
									                 <!-- <div class="hr-line-dashed"></div> -->
									                 <div id="default_comm_div" >
														<div class="row">
															<div class="col-sm-6">
																<div class="form-group">
																	<label class="col-sm-4 control-label">
																		<font color="red">*&nbsp;&nbsp;</font>团队组长默认管理提成(%)
																	</label>
																	<div class="col-sm-8">
																		<input type="text" name="defaultDividend" class="form-control" placeholder="团队组长默认管理提成" value='<fmt:formatNumber value="${product.defaultDividend}" pattern="0.00" />'>
																	</div>
																</div>
															</div>
														</div>
														<!-- <div class="hr-line-dashed"></div> -->
														<div class="row">
															<div class="col-sm-6">
			                                                        <label class="col-sm-4 control-label">
																		<font color="red">*&nbsp;&nbsp;</font>理财师默认佣金(%)
																	</label>
																	<div class="col-sm-8">
																		<input type="text" name="defaultCommission" class="form-control" placeholder="理财师默认佣金" value='<fmt:formatNumber value="${product.defaultCommission}" pattern="0.00" />'>
																	</div>
															</div>
														</div>
													</div>
						                             <!-- <div class="hr-line-dashed"></div> -->
						                              <div class="row" id="customSet">
										                <div class="col-lg-12">
										                    <div class="ibox float-e-margins">
										                        <div class="ibox-content">
										                            <table id="modelEditable_comm" class="table table-striped table-bordered table-hover">
										                                <thead>
											                               	 <tr>
											                                    <th>团队名称</th>
											                                    <th>团队组长</th>
											                                    <th>团队成员</th>
											                                    <th>佣金</th>
											                                </tr>
										                              	  </thead>
											                              <tbody>
											                              </tbody>
											                        </table>
										                        </div>
										                    </div>
										                </div>
										            </div>
                                				
                                				
												</fieldset>
												<h1>相关文件</h1>
                                				<fieldset>
                                					<div class="row" style="padding-left:17px">
													    <div class="col-sm-6">
													        <div class="form-group">
													            <label class="col-sm-4 control-label">相关文件</label>
													             <div id="relatedFileId" class="col-sm-8">
													        		<c:forEach items="${relatedFile}" var="file">
													       			    <div style="padding-top:2px;" id="${file.id}">
													        			    ${file.fileName}
													        			    <button onclick="deleteFile(this)" style="border:0px;background:#0f0;background-color:transparent;" title="删除">
																			    <span aria-hidden="true">&times;</span>
																			    <span class="hide">Close</span>
																			</button>
																			<button id="${file.id}" name="${file.fileName}" type="button" class="btn btn-outline btn-primary btn-xs" onclick="showRenameDialog(this)">重命名</button>
													        			</div>
																		<%-- <input readonly style="border:0px"  type="text" class="form-control" value="${file.fileName}"><br> --%>
																	</c:forEach>
													            </div>
													        </div>
													    </div> 
													  </div>
											          <div class="row" style="padding-left:17px">
														  <div class="col-sm-6">
														      <div class="form-group">
														          <label class="col-sm-4 control-label">上传文件</label>
														          <div class="col-sm-6">
														          	   <input id="relatedFile" class="btn btn-outline btn-primary" type="file" name="relatedFile" accept=".xls,.xlsx,.doc,.docx,.txt,.pdf,.ppt,.pptx">
														          	   <div  style="padding-top:2px"><input class="btn btn-outline btn-primary" type="button" value="上传" onclick="uploadRelatedFile()"></div>
														          </div>
														      </div>
														 </div> 
													</div>  
                                				</fieldset>
                                				<h1>同类产品</h1>
                                				<fieldset>
                                					<div class="tab-content">
								                   		<div class="tab-pane active">
								                            <div class="panel-body">
								                                 <div class="wrapper wrapper-content animated fadeInRight ecommerce">
																	<table style="width:800px;height:340px;">
																		<tr>
																			<td width="340px">
																			    <b>已选的同类产品</b>
																			    <div style="padding-top:10px">
																				<select style="height:300px;" class="form-control" multiple="" id="relatedSelected" name="_relatedId">
																				  <c:forEach items="${relatedProductList}" var="p" varStatus="st">
																					 <option value="${p.id}" name="${p.briefName}"> ${p.briefName}</option>
																				  </c:forEach>
												                                </select>
												                                </div>
																			</td>
																			<td align="center">
																			    <a class="btn btn-white btn-bitbucket" id="addStaff-addAll" onclick="add();"><i class="fa fa-mail-reply"></i></a><br><br>
																				<a class="btn btn-white btn-bitbucket" id="addStaff-add" onclick="_remove();"><i class="fa fa-mail-forward"></i></a>
																			</td>
																			<td width="340px">
																			    <b>产品库</b>
																			    <div style="padding-top:10px">
																				<select style="height:300px;" class="form-control" multiple="" id="relatedUNSelected" name="_relatedId">
																				  <c:forEach items="${productList}" var="p" varStatus="st">
																					 <option value="${p.id}" name="${p.briefName}"> ${p.briefName}</option>
																				  </c:forEach>
												                                </select>
												                                </div>
																			</td>
																		</tr>
																		<tr>
																			<td></td>
																			<td>
																				<div class="form-group">
														                 			<div class="col-sm-2 col-sm-offset-2">
														                 			    <br><br>
														                      			<button class="btn btn-outline btn-primary" type="button" onclick="saveRelatedProduct()">保 存</button>
														                            </div>
														            			</div>
																			</td>
																			<td></td>
																		</tr>
																	</table>
																	
											                    </div>
														    </div>
								        			   </div>
								                  </div> 
                                				</fieldset>
											</form>





											<!-- update model start -->
											<div class="modal inmodal fade" id="updateModel" tabindex="-1" role="dialog" aria-hidden="true">
												<div class="modal-dialog modal-lg">
													<div class="modal-content">
														<div class="modal-header">
															<button type="button" class="close" data-dismiss="modal">
																<span aria-hidden="true">&times;</span>
																<span class="sr-only">Close</span>
															</button>
															<h4 class="modal-title" id="grade_edit_id">产品档次</h4>
														</div>
														<div class="modal-body">
															<div id="updateBody"></div>
															<form id="gradeForm" class="form-horizontal">
																<input type="text" style="display: none" id="productId" name="productId" class="form-control" value="${product.id}"> 
																<input type="text" style="display: none" id="gradeId" name="id" class="form-control">
																<div class="form-group">
																	<label class="col-sm-3 control-label">
																		档次
																	</label>
																	<div class="col-sm-8">
																		<input type="text" id="grade" name="grade" class="form-control">
																	</div>
																</div>
																<div class="form-group">
																	<label class="col-sm-3 control-label">
																		<font color="red">*&nbsp;&nbsp;</font>认购最小金额(万元)
																	</label>
																	<div class="col-sm-8">
																		<input type="text" id="subScopeStart" name="subScopeStart" class="form-control">
																	</div>
																</div>
																<div class="form-group">
																	<label class="col-sm-3 control-label">
																		<font color="red">*&nbsp;&nbsp;</font>认购最大金额(万元)
																	</label>
																	<div class="col-sm-8">
																		<input type="text" id="subScopeEnd" name="subScopeEnd" class="form-control">
																	</div>
																</div>
																<div class="form-group">
																	<label class="col-sm-3 control-label">
																		<font color="red">*&nbsp;&nbsp;</font>预期收益
																	</label>
																	<div class="col-sm-8">
																		<input type="text" id="prospectiveEarnings" name="prospectiveEarnings" class="form-control">
																	</div>
																</div>
																<div class="form-group">
																	<label class="col-sm-3 control-label">
																		备注
																	</label>
																	<div class="col-sm-8">
																		<input type="text" id="grade_remark" name="remark" class="form-control">
																	</div>
																</div>
															</form>
														</div>
														<div class="modal-footer">
															<button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
															<button type="button" id="saveModel" class="btn btn-primary">保 存</button>
														</div>
													</div>

												</div>
											</div>
											<!-- update model end -->
											
											
											<!-- update model start -->
											<div class="modal inmodal fade" id="updateModel_comm" tabindex="-1" role="dialog"  aria-hidden="true">
						                         <div class="modal-dialog modal-lg">
						                              <div class="modal-content">
						                                   <div class="modal-header">
						                                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
						                                        <h4 class="modal-title" id="d_title">待填写</h4>
						                                   </div>
						                                   <div class="modal-body">
							                                   <div id="updateBody_comm"></div>
							                                   <div class="form-horizontal">
							                                		<div class="form-group"><label class="col-sm-2 control-label" id="d_old_val">待填写</label>
							                                    		<div class="col-sm-8"><input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" id="old_val" class="form-control" >
							                                			</div>
							                                		</div>
							                                		<div class="form-group"><label class="col-sm-2 control-label" id="d_new_val">待填写</label>
							                                    		<div class="col-sm-8"><input type="text" id="new_val" class="form-control" >
							                                            </div>
							                                		</div>
							                                		<span id="renameInfo" class="col-sm-2 control-label"></span>
							                                   </div>
														   </div>
						                                   <div class="modal-footer">
						                                        <button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
						                                        <button type="button" class="btn btn-primary" onclick="setRate()">保 存</button>
						                                   </div>
						                                </div>
						                            </div>
						                       </div>
						                       <!-- update model end --> 
						                          
						                       <!-- update model start -->
												<div class="modal inmodal fade" id="updateModel_relatedFile" tabindex="-1" role="dialog"  aria-hidden="true">
					                                <div class="modal-dialog modal-lg">
					                                    <div class="modal-content">
					                                        <div class="modal-header">
					                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					                                            <h4 class="modal-title">重命名</h4>
					                                        </div>
					                                        <div class="modal-body">
					                                        <div id="updateBody_relatedFile"></div>
					                                        <div class="form-horizontal">
					                                			<div class="form-group">
					                                				<label class="col-sm-2 control-label">文件原名</label>
					                                    			<div class="col-sm-8">
					                                    				<input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" id="o_renameFileName" class="form-control" >
					                                				</div>
					                                			</div>
					                                			<div class="form-group">
					                                				<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>文件新名</label>
					                                    			<div class="col-sm-8">
					                                    				<input type="text" id="renameFileName" class="form-control" >
					                                            	</div>
					                                			</div>
					                                			<span id="renameInfo" class="col-sm-2 control-label"></span>
					                                       </div>
																
					                                        </div>
					                                        <div class="modal-footer">
					                                            <button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
					                                            <button type="button" class="btn btn-primary" onclick="renameFile()">保 存</button>
					                                        </div>
					                                    </div>
					                                </div>
					                            </div>
					                            <!-- update model end --> 
					                            
					                            <!-- update model start -->
												<div class="modal inmodal fade" id="newProductGroup" tabindex="-1" role="dialog"  aria-hidden="true">
					                                <div class="modal-dialog modal-lg">
					                                    <div class="modal-content">
					                                        <div class="modal-header">
					                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					                                            <h4 class="modal-title">新增产品组别</h4>
					                                        </div>
					                                        <div class="modal-body">
						                                        <div id="updateBody_newProductGroup"></div>
						                                        <div class="form-horizontal">
						                                			<div class="form-group">
						                                				<label class="col-sm-2 control-label"><font color="red">*&nbsp;&nbsp;</font>组别名称</label>
						                                    			<div class="col-sm-8">
						                                    				<input type="text" id="newProductGroupName" class="form-control" >
						                                            	</div>
						                                			</div>
						                                			<span id="renameInfo" class="col-sm-2 control-label"></span>
						                                      	 </div>
					                                        </div>
					                                        <div class="modal-footer">
					                                            <button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
					                                            <button type="button" class="btn btn-primary" onclick="newProductGroup()">保 存</button>
					                                        </div>
					                                    </div>
					                                </div>
					                            </div>
					                            <!-- update model end -->   
						                            
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<!-- 底部版权 -->
			<jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>

		</div>
	</div>

	<!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.messages-zh_CN.js" type="text/javascript"></script>
	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<!-- Data picker -->
	<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>

	<!-- Data Tables -->
	<script src="js/plugins/dataTables/jquery.dataTables.min.js"></script>
	<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="js/plugins/dataTables/dataTables.responsive.js"></script>
	<script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script>
    
    <!-- Steps -->
    <script src="js/plugins/staps/jquery.steps.min.js"></script>
    
	<!-- 业务 -->
	<script src="js/ajaxfileupload.js"></script>
	<script src="js/jquery.form.js"></script>
	<script src="js/product/product-add.js"></script>
	<script src="js/product/product-grade-module.js"></script>
	 <script src="js/product/product-commission.js"></script> 
	<script src="js/product/FormatUtils.js"></script>
	
	<!-- Chosen -->
    <script src="js/plugins/chosen/chosen.jquery.js"></script>


	<!-- 产品基本信息 -->
	<script>
		$(document).ready(function() {
			ProductAdd.init();
			
			$("#addForm").steps({
                bodyTag: "fieldset",
                onStepChanging: function (event, currentIndex, newIndex)
                {
                	$("a[href=#finish]").css("display","none");
                	
                    if (currentIndex > newIndex)
                    {
                        return true;
                    }

                    var form = $(this);

                    if (currentIndex < newIndex)
                    {
                        $(".body:eq(" + newIndex + ") label.error", form).remove();
                        $(".body:eq(" + newIndex + ") .error", form).removeClass("error");  
                    }

                    form.validate().settings.ignore = ":disabled,:hidden";

                    var flag = form.valid();
                    
                    if(!flag){
                    	return flag;
                    }
                    
                    //此处是离开时，当前下标为...
                    if(currentIndex==0){
                    	addProductBaseInfo(this);
                    }else if(currentIndex==1){
                    	if(!$("#contactFile").text()){
                    		$("#productContactFile-error").text("请点击上传按钮上传合同！");
                    		return false;
                    	}
                    	
                    	$('#modelEditable').dataTable().fnClearTable();
                    }else if(currentIndex==3){
                    	updateDefaultCommission();
                    }
                    
                    return flag;
                },
                onStepChanged: function (event, currentIndex, priorIndex)
                {
                	 
                    //此处是到达时，目标下标为..
                    if(currentIndex==3){
                    	//初始化佣金
                    	oTable.fnClearTable();
                    }else if (currentIndex == 5){
                        
                        //初始化同类产品
                        initRelatedProduct();
                    	 $("a[href=#finish]").css("display","");
                    }  

                },
                onFinishing: function (event, currentIndex)
                {
                    var form = $(this);

                    form.validate().settings.ignore = ":disabled";

                    return form.valid();
                },
                onFinished: function (event, currentIndex)
                {
                    var form = $(this);

                    window.location.href= 'product/list';
                }
            }).validate({
                        errorPlacement: function (error, element)
                        {
                            element.before(error);
                        },
                        rules: {
                            confirm: {
                                //equalTo: "#password"
                            }
                        }
                    });
			
			ProductGradeModule.init();
			initSpecifiedContent(); 
			CommissionSetModule.init();
			checkOpenDate();
			
			//下拉框
			var config = {
	                '.chosen-select'           : {},
	                '.chosen-select-deselect'  : {allow_single_deselect:true},
	                '.chosen-select-no-single' : {disable_search_threshold:10},
	                '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
	                '.chosen-select-width'     : {width:"95%"}
	                }
	       for (var selector in config) {
	                $(selector).chosen(config[selector]);
	       }
			
			$("a[href=#previous]").text("上一步");
			$("a[href=#next]").text("下一步");
			$("a[href=#finish]").text("完成");
			$("a[href=#finish]").css("display","none");
			$("a[href=#cancel]").css("display","none");
			
			_initSpecifiedContent();
		});

		function initSpecifiedContent() {
			$('#recruitStartTime').datepicker({
				todayBtn : "linked",
				keyboardNavigation : false,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true
			});

			$('#recruitEndTime').datepicker({
				todayBtn : "linked",
				keyboardNavigation : false,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true
			});
			
			$('#recruitStartTime').datepicker().on('changeDate', function(ev){
             	var date = $('#recruitStartTime').val();
             	var date2 = $('#recruitEndTime').val();
             	var startDate = Date.parse(date);
             	var endDate = Date.parse(date2);
             	var today = new Date();
             	var todayTime = today.getTime();
                if(startDate > endDate){
                		bootbox.alert("招募开始时间不能小于截止时间.");
                		$('#recruitStartTime').val("");
                	}
                	$('#recruitStartTime').datepicker('hide');
            }); 
			
			$('#recruitEndTime').datepicker().on('changeDate', function(ev){
             	var date = $('#recruitStartTime').val();
             	var date2 = $('#recruitEndTime').val();
             	var startDate = Date.parse(date);
             	var endDate = Date.parse(date2);
             	var today = new Date();
             	var todayTime = today.getTime();
                	if(startDate > endDate){
                		bootbox.alert("招募截止时间不能小于开始时间.");
                		$('#recruitEndTime').val("");
                	}
                	$('#recruitEndTime').datepicker('hide');
            }); 
			
			$('#setupTime').datepicker({
				todayBtn : "linked",
				keyboardNavigation : false,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true
			});
			
			$('#interestDate').datepicker({
				todayBtn : "linked",
				keyboardNavigation : false,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true
			}); 
			
			$.ajax({  
			     url:ctx + '/product/about',// 跳转到 action  
			     //data:json,
			     type:'get',  
			     //async: false,
			     cache:false,  
			     dataType:'json',  
			     success:function(data) {  
			    	 if(data.code == 1){
			    		 var abouts = $("#aboutId").html();
	                	 $(data.data).each(function(i,val) { 
	                			abouts += '<option value="'+val.id+'" name="'+val.title + '">'+val.title + '</option>';
	                		});
			    		 $("#aboutId").html(abouts);
			    	 }
			    	 
			      },  
			      error : function() {  
			    	  //bootbox.alert("新增产品基本信息出错。");
			      }  
			 });
			
		}

		function addProductBaseInfo(){
			var json = $('form#addForm').serializeObject();
			json.selectedFundManager = "'"+$("#_fundManager").val()+"'";
			json.selectedInvestorGroup = "'"+$("#_investorGroup").val()+"'";
			json.selectedEmployeeGroup = "'"+$("#_employeeGroup").val()+"'";
			
			$.ajax({  
			     url:ctx + '/product/doAdd',// 跳转到 action  
			     data:json,
			     type:'post',  
			     //async: false,
			     cache:false,  
			     dataType:'json',  
			     success:function(data) {  
			    	 if(data.code == 1){
			    		 $("input[name=id]").val(data.data.id);
			    		 $("#productId").val(data.data.id);
			    		 uploadProductImage();
			    		 return true;
			    	 }
			    	 
			    	 return false;
			      },  
			      error : function() {  
			    	  //bootbox.alert("新增产品基本信息出错。");
			    	  return false;
			      }  
			 });
		}
			
		function uploadProductImage(){
			if(!$("#productImage").val()){
				return;
			}
			
			 $.ajaxFileUpload({
	                url: ctx + '/product/upload',
	                type: 'post',
	                secureuri: false,
	                fileElementId: 'productImage',
	                dataType: 'json',
	                data: {'id':$("input[name=id]").val()},
	                success: function(data, status){
	                	if (data.code == 1) {
	                        $("#showProductImage").attr("src","${imagePrefix}"+data.data.thumbnail);
	                        $("#productImageDiv").css("display","");
	                        $("#productImage").rules("remove");
	                	} else {
	                		bootbox.alert(data.message);
	                	}
	                },
	                error: function(msg, status, e){
	                	bootbox.alert("上传产品图片出错。");
	                }
	            });
			 } 
		
		function uploadProductContact(){
			if(!$("#productContactFile").val()){
				return;
			}
			
			 $.ajaxFileUpload({
	                url: ctx + '/product/upload',
	                type: 'post',
	                secureuri: false,
	                fileElementId: 'productContactFile',
	                dataType: 'json',
	                data: {'id': $("input[name=id]").val()},
	                success: function(data, status){
	                	if (data.code == 1) {
	                        $("#contactFile").text(data.data.contactFile.match(/[^\\/]*$/)[0]);
	                        $("#reviewContact").attr("onclick","javascript:location.href='product/downloadEffect?productId="+data.data.id+"'");
	                        $("#productContactFileDiv").css("display","");
	                        $("#productContactFile").rules("remove");
	                        $("#productContactFile-error").text("");
	                        bootbox.alert("上传成功！");
	                	} else {
	                		bootbox.alert("上传失败！");
	                	}
	                },
	                error: function(msg, status, e){
	                	bootbox.alert("上传失败！");
	                }
	            });
			 } 
		
		function _showApp(obj){
    		$("#showApp").val(obj.checked);
    		if(obj.checked){
    			$("#pushGroup").show();
    		}else{
    			$("#pushGroup").hide();
    		}
    	}
		
	</script>
	
   
   
    <!-- 佣金设置 -->
    <script>
       
        function _initSpecifiedContent(){
        	$("input[type='radio'][value='option1']").attr("checked","checked" );
        	$("#customSet").hide();
        	$("#default_comm_div").show();
        	
        	 $("input[name='optionsRadios']").bind("click",function(){ 
                 
        	        //测试操作代码 
        	        if($(this).val()=="option1"){
        	        	$("#customSet").hide();
        	        	$("#default_comm_div").show();
        	        	updateCommissionSetButton(true);
        	        }else{
        	        	var flag = $("#addForm").valid();
        	        	if(!flag){
        	        		return false;
        	        	}
        	        	
        	        	// 1-表示新增或刷新默认佣金值，再刷新自定义佣金表
        	        	updateDefaultCommission(1);
        	        	$("#customSet").show();
        	        	$("#default_comm_div").hide();
        	        	updateCommissionSetButton(false);
        	        }
        	 });
        }
        
        function updateCommissionSetButton(flag){
        	$.ajax({
            	type:"get",
                url: ctx + "/product/update",
                data:"id="+$("#productId").val()+"&defaultCommissionSet="+flag,
                dataType:"json",
                success: function(data){
                	
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
        }
        
        var employeeId;
        function setRate(){
        	var old_val = $("#old_val").val();
        	var new_val = $("#new_val").val();
        	if(null == new_val || "" == new_val.trim() || old_val==new_val){
        		bootbox.alert("请输入与原费率不同的且不为空的值！");
        		return;
        	}
        	
        	if(new_val<0||new_val>100){
        		bootbox.alert("请输入0-100费率值！");
        		return;
        	}
        	
            var productId = $("#productId").val();
            var param = $("#d_title").text().indexOf("提成")!=-1?"&dividendRate="+new_val:"&commissionRate="+new_val;
            
        	$.ajax({
            	type:"post",
                url: ctx + "/product/setRate",
                data:"productId=" + productId +"&employeeId="+employeeId+param,
                dataType:"json",
                success: function(data){
                	if (data.code == 1) {
                		modal.modal('hide');
                		bootbox.alert("设置成功！");
                		oTable.fnClearTable();
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
        }
        
        function updateDefaultCommission(flag){
        	$.ajax({
            	type:"get",
                url: ctx + "/product/update",
                data:"id="+$("#productId").val()+"&defaultDividend="+$("input[name=defaultDividend]").val()+"&defaultCommission="+$("input[name=defaultCommission]").val(),
                dataType:"json",
                success: function(data){
                	if(flag==1){
                		oTable.fnClearTable();
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
        }
    </script>
    
    <!-- 产品相关文件 -->
    <script>
        
        function uploadRelatedFile(){
			if(!$("#relatedFile").val()){
				bootbox.alert("请先添加文件！");
				return;
			}
			
			 $.ajaxFileUpload({
	                url: ctx + '/productAttachment/uploadRelatedFile',
	                type: 'post',
	                secureuri: false,
	                fileElementId: 'relatedFile',
	                dataType: 'json',
	                data: {'productId': $("input[name=id]").val()},
	                success: function(data, status){
	                	if (data.code == 1) {
	                		bootbox.dialog({
	        					message : "上传成功！ ",
	        					title : "温馨提示：",
	        					buttons : {
	        						main : {
	        							label : "确定",
	        							className : "btn btn-outline btn-primary",
	        							callback : function() {
	        								getRelatedFile();
	        							}
	        						}
	        					}
	        				});
	                		
	                	} else {
	                		bootbox.alert(data.message);
	                	}
	                },
	                error: function(msg, status, e){
	                	bootbox.alert("上传失败！");
	                }
	            });
			 } 
        
        
        function deleteFile(obj){
            bootbox.confirm("您确定要删除这个文件?", function(result) {
                if (result) {
                	var nRow = $(obj).parents('div')[0];
                    var id = nRow.id;
                    
                    $.ajax({
                    	type:"get",
                        url: ctx + "/productAttachment/delete",
                        data:"id=" + id,
                        dataType:"json",
                        success: function(msg){
                        	if (msg.code == 1) {
                        		getRelatedFile();
                        		bootbox.alert("删除文件成功！");
                        	} else {
                        		bootbox.alert("删除文件失败！");
                        	}
                        },
                        error: function (msg) {
                        	bootbox.alert(msg.message);
                        }
                    });
                }
            });
        }
        
        function getRelatedFile(){
        	$.ajax({
            	type:"get",
                url: ctx + "/productAttachment/query/"+$("input[name=id]").val(),
                dataType:"json",
                success: function(data){
                	if (data.code == 1) {
                		var objs = data.data.relatedFile;
                    	var html = "";
                    	var closeBttn = '<button onclick="deleteFile(this)" style="border:0px;background:#0f0;background-color:transparent;" title="Close">'+
    						            '<span aria-hidden="true">&times;</span>'+
    							        '<span class="hide">Close</span>'+
    					                '</button>';
    					
                    	for(var i=0;i<objs.length;i++){
                    		var id = objs[i].id;
                    		var fileName = objs[i].fileName;
                    		var renameBttn = '<button id="'+id+'" name="'+fileName+'" type="button" class="btn btn-outline btn-primary btn-xs" onclick="showRenameDialog(this)">重命名</button>';
                    		html+="<div style='padding-top:2px' id='"+id+"'>"+fileName+closeBttn+renameBttn+"</div>";
                    	}
                    	$("#relatedFileId").html(html);
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
        }
        var modal;
        function showRenameDialog(obj){
        	var filename = $(obj).attr('name').split(".")[0];
        	$("#o_renameFileName").val(filename);
        	$("#renameFileName").val(filename);
        	$("#renameFileName").attr('name',$(obj).attr('id'));
        	modal = $('#updateModel_relatedFile').modal('show');
        }
        
        function renameFile(){
        	var o_filename = $("#o_renameFileName").val();
        	var filename = $("#renameFileName").val();
        	if(o_filename==filename){
        		bootbox.alert("请输入与原文件名不同的名字！");
        		return;
        	}
        	
            var id = $("#renameFileName").attr('name');

        	$.ajax({
            	type:"post",
                url: ctx + "/productAttachment/rename",
                data:"id=" + id+"&fileName="+filename,
                dataType:"json",
                success: function(data){
                	if (data.code == 1) {
                		modal.modal('hide');
                		bootbox.alert("更新文件名字成功！");
                		getRelatedFile();
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
        }
    </script>
    
     <!-- 同类产品 -->
    <script>
	    function initRelatedProduct(){
	    	$.ajax({
            	type:"get",
                url: ctx + "/productRelated/list/"+$("input[name=id]").val(),
                dataType:"json",
                success: function(data){
                	if (data.code == 1) {
                		var relatedUNSelected = "";
                		$(data.data.productList).each(function(i,val) { 
                			relatedUNSelected += '<option value="'+val.id+'" name="'+val.briefName + '">'+val.briefName + '</option>';
                		});
                		$("#relatedUNSelected").html(relatedUNSelected);
                		
                		var relatedSelected = "";
                		$(data.data.relatedProductList).each(function(i,val) { 
                			relatedSelected += '<option value="'+val.id+'" name="'+val.briefName + '">'+val.briefName + '</option>';
                		});
                		$("#relatedSelected").html(relatedSelected);
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
	    }
        
        function _remove() {
    		var se1 = $('#relatedSelected')[0];
    		var se2 = $('#relatedUNSelected')[0];
    		var lenth = se1.length;
    		var i=0;
    	    for(;i<lenth; ) {
    	        if(se1[i].selected) {
    	            var opt = document.createElement('option');
    	            opt.value = se1[i].value;
    	            var node = document.createTextNode(se1[i].innerHTML);
    	            opt.appendChild(node);
    	            se2.appendChild(opt);
    	            se1.removeChild(se1[i]);
    	            lenth = lenth -1;
    	            i=0
    	        }
    	        else{
    	        	i++;
    	        }
    	    }
    	}
    	function add() {
    		var se1 = $('#relatedSelected')[0];
    		var se2 = $('#relatedUNSelected')[0];
    		var lenth = se2.length;
    		var i=0;
    	    for(;i<lenth;) {
    	        if(se2[i].selected) {
    	            var opt = document.createElement('option');
    	            opt.value = se2[i].value;
    	            var node = document.createTextNode(se2[i].innerHTML);
    	            opt.appendChild(node);
    	            se1.appendChild(opt);
    	            se2.removeChild(se2[i]);
    	            lenth = lenth -1;
    	            i=0
    	        }else{
    	        	i++;
    	        }
    	    }
    	}
    	
    	function saveRelatedProduct(){
    		var se1 = $('#relatedSelected')[0];
    		var arr = new Array();
    	    for(var i=0;i<se1.length;i++) {
    	    	arr.push(se1[i].value);
    	    }
    	    
    	    var se2 = $('#relatedUNSelected')[0];
    	    if(se1.length==0&&se2.length==0){
    	    	return;
    	    }
    	    
    	    $.ajax({
            	type:"post",
                url: ctx + "/productRelated/save",
                data:"productId="+$("input[name=id]").val()+"&relatedIds=" +arr ,
                dataType:"json",
                success: function(msg){
                	if (msg.code == 1) {
                		bootbox.dialog({
        					message : "保存相关产品成功！",
        					//title : "温馨提示：",
        					buttons : {
        						main : {
        							label : "确定",
        							className : "btn btn-outline btn-primary",
        							callback : function() {
        								initRelatedProduct();
        							}
        						}
        					}
        				});
                	} else {
                		bootbox.alert("保存相关产品失败！");
                	}
                },
                error: function (msg) {
                	bootbox.alert(msg.message);
                }
            });
    	}
    </script>
    
    <!-- 新增产品组别 -->
    <script>
    	var productGroupModal;
    	var currentId = "";
	    function showProductGroupDialog(){
        	$("#newProductGroupName").val("");
        	productGroupModal = $('#newProductGroup').modal('show');
        	currentId = $("#productGroupId").val();
	    }
	    
    	function newProductGroup(){
    		var name = $("#newProductGroupName").val().trim();
    		if(name == ""){
        		bootbox.alert("产品组别不能为空！");
        		return;
        	}
    		
    		$.ajax({
             	type:"post",
                 url: ctx + "/productGroup/newGroup",
                 data: "name=" + name,
                 dataType:"json",
                 success: function(data){
                	 if(data.code==1){
                		productGroupModal.modal('hide');
                     	bootbox.alert("新增产品组别成功！");
                     	
                     	var groupOption = '<option value="">无</option>';
                     	$.each(data.data, function(n, value) {   
                              groupOption += '<option value="'+value.id+'" name="'+value.name+'">'+value.name+'</option>';    
                        });  
                   
                       $("#productGroupId").html(groupOption);  
                       $("#productGroupId").val(currentId);
                 	}else{
	                    bootbox.alert(data.message);
                 	}
                 },
                 error: function (msg) {
                 	bootbox.alert(msg.message);
                 }
          	});
    	}
    </script>
</body>
</html>